﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<skags.Models.PollModels>" %>

<% if (Model != null)
   {%>
<p><%: Model.Question%></p>
<%
    if (Request.Cookies["Brjostagjof_" + Model.id] != null)
        Response.Write("<span style=\"font-weight: normal\">Þú ert búinn að kjósa í þessari könnun.</span>");
    else
    {
    %><form method="post" action="/Poll/Vote/">
    <%= Html.HiddenFor(m => m.id)%>
        <%: Html.ValidationSummary(true, "Ekki tókst að vista svar. Vinsamlegast farið yfir það sem var sett inn og reynið aftur.")%>
            
                        <% if (Model.Option1 != null) %>
                        <% { %>
                            <input type="radio" name="Opt" id="Radio1" value="Vote1"><%: Model.Option1%><br>
                        <% } %>
                        <% if (Model.Option2 != null) %>
                        <% { %>
                            <input type="radio" name="Opt" id="Radio2" value="Vote2"><%: Model.Option2%><br>
                        <% } %>
                        <% if (Model.Option3 != null) %>
                        <% { %>
                            <input type="radio" name="Opt" id="Radio3" value="Vote3"><%: Model.Option3%><br>
                        <% } %>
                        <% if (Model.Option4 != null) %>
                        <% { %>
                            <input type="radio" name="Opt" id="Radio4" value="Vote4"><%: Model.Option4%><br>
                        <% } %>
                        <% if (Model.Option5 != null) %>
                        <% { %>
                            <input type="radio" name="Opt" id="Radio5" value="Vote5"><%: Model.Option5%><br>
                        <% } %>
             
                <br />
          
            <br />
            
                <input type="submit" name="submit_poll" value="Kjósa" />
                <% } %>
                <br /><br />
                 
                <a href="/Poll/Latest">Skoða niðurstöður</a><br />
                <a href="/Poll/Polls">Skoða eldri kannanir</a>
     </form>

     <% } %>